import {request} from '../request';

// 基础路径
const baseUrl = '/resource';

/**
 * 查询资源列表接口
 */
export function resourceList(params?: Api.SystemManage.SearchResourceParam) {
  return request<Api.SystemManage.ResourceList>({
    url: `${baseUrl}/list`,
    method: `post`,
    params
  });
}

/**
 * 获取资源详情接口
 */
export function resourceDetail(id: number) {
  return request<Api.SystemManage.ResourceInfo>({
    url: `${baseUrl}/detail?id=${id}`,
    method: `get`,
  })
}

/**
 * 删除资源接口
 */
export function resourceDelete(data: Api.Common.DeleteParams[]) {
  return request({
    url: `${baseUrl}/delete`,
    method: `post`,
    data
  })
}

/**
 * 授权资源查询
 */
export function grantResource(){
  return request<Api.SystemManage.GrantResourceList>({
    url: `${baseUrl}/grantResource`,
    method: `get`
  })
}

// 基础路径
const buttonUrl = '/button';

/**
 * 获取菜单下面的按钮列表
 * @param data
 */
export function getButtonList(data: Api.SystemManage.SearchButtonParam){
  return request<Api.SystemManage.MenuButton>({
    url: `${buttonUrl}/getButtons`,
    method: `post`,
    data
  })
}




